package com.enation.app.javashop.core.client.fallback.member;

import com.enation.app.javashop.core.client.feignimpl.member.DepositeClientFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.enation.app.javashop.model.member.dos.MemberWalletDO;
import com.enation.app.javashop.model.member.vo.MemberDepositeVO;
import org.springframework.stereotype.Component;

/**
 * 预存款客户端熔断fallback factory
 * @author kingapex
 * @version 1.0
 * @data 2022/5/28 14:24
 **/
@Component
public class DepositeClientFallbackFactory  extends BaseFallbackFactory<DepositeClientFeignImpl> {
    @Override
    protected DepositeClientFeignImpl fallback() {
        return new DepositeClientFallback();
    }

    /**
     * 预存款客户端熔断
     *
     * @author fk
     * @version v7.0
     * @date 20/3/2 下午3:27
     * @since v7.2
     */
    @Component
    public static class DepositeClientFallback implements DepositeClientFeignImpl {

        private final Logger logger = LoggerFactory.getLogger(getClass());

        @Override
        public Boolean increase(Double money, Long memberId, String detail) {
            logger.error("增加会员预存款余额异常memberid" + memberId);
            return null;
        }

        @Override
        public Boolean reduce(Double money, Long memberId, String detail) {
            logger.error("减少会员预存款余额异常memberid" + memberId);
            return null;
        }

        @Override
        public MemberWalletDO getModel(Long memberId) {
            logger.error("获取会员钱包信息异常memberid" + memberId);
            return null;
        }

        @Override
        public MemberWalletDO add(MemberWalletDO walletDO) {
            logger.error("添加会员钱包信息" + walletDO);
            return null;
        }

        @Override
        public void checkPwd(Long memberId, String password) {
            logger.error("校验支付密码异常memberid" + memberId);
        }

        @Override
        public MemberDepositeVO getDepositeVO(Long memberId) {
            logger.error("获取预存款支付相关异常memberid" + memberId);
            return null;
        }
    }
}
